package com.sto.stoapp.activity.administrator;

import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;
import android.widget.Button;

import com.sto.stoapp.StoApplication;
import com.sto.stoapp.activity.R;
import com.sto.stoapp.broadcast.HomeBroadAction;
import com.sto.stoapp.listener.StoOnClickListener;
import com.sto.stoapp.util.Helper;
import com.sto.stoapp.widget.StoHomeActivity;

public class AdminGpsActivity extends StoHomeActivity {

	private Button gpsAutoLoadText, gpsInfomationText, gpsSwitchText;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.admin_gps);
		this.setTitleBottom(R.string.gps_settings,
				HomeBroadAction.ADMINISTRATOR_BROAD);
		initWidget();
		initListener();
	}

	private void initListener() {
		gpsSwitchText.setOnClickListener(new StoOnClickListener(this) {

			@Override
			public void mHonClick(View view) {
				Intent intent;
				if (Helper.getPDAType().equals(StoApplication.DeviceModel_420))
					intent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
				else
					intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
				startActivity(intent);
			}
		});

		gpsAutoLoadText.setOnClickListener(new StoOnClickListener(this) {

			@Override
			public void mHonClick(View view) {
				Intent intent = new Intent(AdminGpsActivity.this,
						SettingGpsTimeActivity.class);
				startActivity(intent);
			}
		});

		gpsInfomationText.setOnClickListener(new StoOnClickListener(this) {

			@Override
			public void mHonClick(View view) {
				Intent intent = new Intent(AdminGpsActivity.this,
						AdminGpsInfomationActivity.class);
				startActivity(intent);
			}
		});
	}

	private void initWidget() {
		gpsSwitchText = (Button) findViewById(R.id.gps_switch);
		gpsAutoLoadText = (Button) findViewById(R.id.gps_auto_load);
		gpsInfomationText = (Button) findViewById(R.id.gps_infomation);
	}


}
